package com.sl.rest.controllers;

import com.sl.rest.feign.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Controller
@ResponseBody
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private UserFeignClient userFeignClient;

    @GetMapping("/info")
    public List<Map<String, String>> info() {
        return Arrays.asList(
                Collections.singletonMap("user", userFeignClient.getName()),
                Collections.singletonMap("commodity", "橘子")
        );
    }
}
